package com.ugoodtech.mdcc.core.domain;

        /* Copyright (C) Ugoodtech, Inc - All Rights Reserved.
         * Unauthorized copying of this file, via any medium is strictly prohibited.
         * Proprietary and confidential.
         * Written by Stone Shaw.
         */

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.util.List;

@ApiModel("问题")
@Entity
@Table(name = "questions")
public class Question extends BaseEntity {
    @ApiModelProperty("不可编辑")//Blank加 默认为false
    private boolean doNotEdit = false;
    @ApiModelProperty("主题")
    private String subject;
    @ApiModelProperty("关键字")
    private String strkey;//关键字,油漆品牌-key->"yqpp"
    @ApiModelProperty("题目类型")
    private QuestionCategory category;
    @ApiModelProperty("校验")
    private String validation;//校验
    @ApiModelProperty("是否必须")
    private boolean required;//是否必须
    @ApiModelProperty("问卷章节")
    private QuestionSection section;
    @ApiModelProperty("问题分组")
    private QuestionGroup qGroup;
    private Integer idx;//排序
    @ApiModelProperty("备注信息")
    private String description;//备注信息
    @ApiModelProperty("标准答案")
    private String standardAnswer;//备注信息
    @ApiModelProperty("类型")
    private String type;//备注信息
    @ApiModelProperty("选项数据")
    private List<QuestionAnswerOption> options;

    @ApiModelProperty("单选题的选项")
    @Transient
    private String selected = "";
    @ApiModelProperty("文本框答案")
    @Transient
    private String answer_other = "";
    @ApiModelProperty("文本框答案2")
    @Transient
    private String answer_other2 = "";
    @ApiModelProperty("回答上传的图片")
    @Transient
    private String answer_photo = "";
    @ApiModelProperty("暂存的章节页面")
    @Transient
    private Long sectionId;
    @ApiModelProperty("锚点")
    @Transient
    private String anchor;
    @ApiModelProperty("拥有者")
    private Integer owner;

    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "section_id")
    public QuestionSection getSection() {
        return section;
    }

    public void setSection(QuestionSection section) {
        this.section = section;
    }


    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public QuestionCategory getCategory() {
        return category;
    }

    public void setCategory(QuestionCategory category) {
        this.category = category;
    }

    public String getValidation() {
        return validation;
    }

    public void setValidation(String validation) {
        this.validation = validation;
    }

    @Column(unique = true)
    public String getStrkey() {
        return strkey;
    }

    public void setStrkey(String strkey) {
        this.strkey = strkey;
    }

    public Boolean getRequired() {
        return required;
    }

    public void setRequired(Boolean required) {
        this.required = required;
    }

    public Integer getIdx() {
        return idx;
    }

    public void setIdx(Integer idx) {
        this.idx = idx;
    }

    public Integer getOwner() {
        return owner;
    }

    public void setOwner(Integer owner) {
        this.owner = owner;
    }

    @ManyToOne
    @JoinColumn(name = "group_id")
    @JsonIgnore
    public QuestionGroup getqGroup() {
        return qGroup;
    }

    public void setqGroup(QuestionGroup qGroup) {
        this.qGroup = qGroup;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getStandardAnswer() {
        return standardAnswer;
    }

    public void setStandardAnswer(String standardAnswer) {
        this.standardAnswer = standardAnswer;
    }

    @Transient
    public List<QuestionAnswerOption> getOptions() {
        return options;
    }

    public void setOptions(List<QuestionAnswerOption> options) {
        this.options = options;
    }

    @Transient
    public String getType() {
        return "question";
    }

    public void setType(String type) {
        this.type = type;
    }


    public boolean isDoNotEdit() {
        return doNotEdit;
    }

    public void setDoNotEdit(boolean doNotEdit) {
        this.doNotEdit = doNotEdit;
    }

    public boolean isRequired() {
        return required;
    }

    public void setRequired(boolean required) {
        this.required = required;
    }

    public String getSelected() {
        return selected;
    }

    public void setSelected(String selected) {
        this.selected = selected;
    }

    public String getAnswer_other() {
        return answer_other;
    }

    public void setAnswer_other(String answer_other) {
        this.answer_other = answer_other;
    }

    public String getAnswer_photo() {
        return answer_photo;
    }

    public void setAnswer_photo(String answer_photo) {
        this.answer_photo = answer_photo;
    }

    public Long getSectionId() {
        return sectionId;
    }

    public void setSectionId(Long sectionId) {
        this.sectionId = sectionId;
    }

    public String getAnchor() {
        return anchor;
    }

    public void setAnchor(String anchor) {
        this.anchor = anchor;
    }

    public String getAnswer_other2() {
        return answer_other2;
    }

    public void setAnswer_other2(String answer_other2) {
        this.answer_other2 = answer_other2;
    }
}
